<template>
    <div>
        <h1>修改</h1>
        <br>
        修改标题：<input type="text" v-model="title">
        <br>
        <button @click="alter()">确认修改</button>
    </div>
</template>

<script>
export default {
    data:function(){
        return{
            title:'',
        }
    },
    methods:{
        alter:function(id){
            var id = this.$route.query.id;
            let formData = new FormData();
            formData.append('title', this.title);
            formData.append('id', id);

            this.axios({
                url:'http://127.0.0.1:8000/alter/',
                method: 'post',
                data: formData,
            }).then((res)=>{
                if(res.data.code==200)
                {
                    alert("修改成功")
                }else{
                    alert("信息出错")
                }
            })
        },
    }
}
</script>
